﻿using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Windows.Forms;

namespace Interface
{
    public interface ILogicAnalyzer
    {
        IEnumerable<long> FrequenciesSupported { get; }
        IEnumerable<long> SampleSizesSupported { get; }

        long GetSampleFrequency(IDictionary<string, string> sampleSettings);

        string Name { get; }
        UserControl SettingsPanel{ get; }
        IEnumerable<ICommunication> CommunicationDevices { get; }
        string PrettyPrintSampleSettings(IDictionary<string, string> sampleSettings);

        /// <summary>Load the data from a stream</summary>
        /// <param name="stream">the stream to load the data from</param>
        /// <returns>The data loaded from the stream</returns>
        IData Load(Stream stream);

        /// <summary>
        /// Write the data to a stream
        /// </summary>
        /// <param name="samplePacket">The data to save</param>
        /// <param name="stream">The stream to write to</param>
        void Save(IData samplePacket, Stream stream);

        /// <summary>
        /// Acquire the data from a logic analyzer device.
        /// Data is returned using the backgroound worker.
        /// </summary>
        void Acquire(BackgroundWorker backgroundWorker, DoWorkEventArgs doWorkEventArgs);
    }
}
